this._player.next();
});
- this._player.connect('changed', this._update.bind(this));
- this._player.connect('closed', this.close.bind(this));
+ this._updateHandlerId =
+ this._player.connect('changed', this._update.bind(this));
+ this._closedHandlerId =
+ this._player.connect('closed', this.close.bind(this));
this._update();
}
+ _onDestroy() {
+ super._onDestroy();
+ this._player.disconnect(this._updateHandlerId);
+ this._player.disconnect(this._closedHandlerId);
+ }
+
vfunc_clicked() {
this._player.raise();
Main.panel.closeCalendar();
if (visible)
this.emit('show');
else
- this._close();
+ this.emit('hide');
}
}
};
() => {
this._players.delete(busName);
});
- player.connect('show',
- () => {
- let message = new MediaMessage(player);
- this.addMessage(message, true);
- });
+ player.connect('show', () => {
+ this._message = new MediaMessage(player);
+ this.addMessage(this._message, true);
+ });
+ player.connect('hide', () => {
+ this.removeMessage(this._message, true);
+ this._message = null;
+ });
this._players.set(busName, player);
}
if (!name.startsWith(MPRIS_PLAYER_PREFIX))
return;
- if (newOwner && !oldOwner)
+ if (newOwner && !oldOwner) {
+ if (this._message)
+ this.removeMessage(this._message);
this._addPlayer(name);
+ }
}
});